<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>删除页面上的所有p元素</title>
<style>
    .block{
    width: 100%;
    padding: 20px; 
    margin-bottom: 10px; 
    
    color: #333; 
    font-family: Arial, sans-serif; 
    font-size: 20px; 
    text-align: center; 
    
    background-color: #f2f2f2; 
    
    border-radius: 10px;
    }
    .line{
       
    width: 100%; 
    height: 1px;
    background-color: #ccc; 
    margin-top: 10px; 
    }
</style>
<script>
function delp() {
  var paragraphs = document.querySelectorAll('p');

  
  for (var i = 0; i < paragraphs.length; i++) {
    paragraphs[i].parentNode.removeChild(paragraphs[i]);
  }
}
</script>
</head>
<body>

<p>什么是JavaScript</p>
<p>JavaScript是一门功能强大的编程语言</p>
<div class="block">
    一起来学习JavaScript程序设计
</div> 
<div class="line"></div>
<p>JavaScript的发展史</p>
<input type="button" value="删除所有p元素" onclick="delp()">
</body>
</html>